package cn.gongxi._05mvcboot01.common.exception;

import cn.gongxi._05mvcboot01.common.response.JsonResult;
import cn.gongxi._05mvcboot01.common.response.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    // 处理全局异常
    @ExceptionHandler
    public JsonResult handleException(Exception ex) {

        return new JsonResult(StatusCode.ILLEGAL_ARGUMENT, ex.getMessage());
    }

}
